#define _CRT_SECURE_NO_WARNINGS 1

int removeDuplicates(int* nums, int numsSize)
{
    int ptr = 0;
    int cur = ptr + 1;
    while (cur < numsSize)
    {
        if (nums[ptr] == nums[cur])
        {
            cur++;
        }
        else
        {
            nums[++ptr] = nums[cur++];
        }
    }
    return ptr + 1;
}

int main()
{
    int arr[] = { 1,1,2,3,4,4,5,6,6 };
    int size = sizeof(arr) / sizeof(arr[0]);
    int ret = removeDuplicates(arr, size);
    printf("%d\n", ret);
    for (int i = 0; i < ret; i++)
    {
        printf("%d ", arr[i]);
    }
    return 0;
}